/*
 * Copyright (c) 2017年11月10日  by XuanWu Wireless Technology Co., Ltd 
 *             All rights reserved  
 */
package com.zml.demo;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author <a href="mailto:zhaominglin@wxchina.com">minglin.Zhao</a>
 * @Description
 * @Date 2017/11/10
 * @Version 1.0.0
 */
public class Demo {
    public static void main(String[] args) {
        Demo demo = new Demo();
        ExecutorService pool = Executors.newFixedThreadPool(2);
        pool.execute(demo.run1);
        pool.execute(demo.run2);
    }

    private Runnable run1 = new Runnable() {
        @Override
        public void run() {
            for (int i = 0; i <50 ; i++) {
                System.out.println("run1````"+i);
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    };
    private Runnable run2 = new Runnable() {
        @Override
        public void run() {
            for (int i = 0; i < 10; i++) {
                System.out.println("run2````"+i);
                try {
                    Thread.sleep(5000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    };
}
